#ifndef OMRONWIDGET_H
#define OMRONWIDGET_H

#include <QWidget>
#include <QDebug>
#include <QKeyEvent>
#include <QTimer>
#include <QSettings>
#include <QSignalMapper>
#include <QMessageBox>
#include "fins.h"

namespace Ui {
    class OmronWidget;
}

enum TActivity { ActInAct, PasInAct, Pas };
enum TState { Norma, Proc, WaitSend, Err, NoData };

class OmronWidget : public QWidget
{
    Q_OBJECT

    Q_PROPERTY( int value READ value WRITE setValueI )
//    Q_PROPERTY( int NextFld READ getNextFld WRITE setNextFld)
//    Q_PROPERTY( int PrevFld READ getPrevFld WRITE setPrevFld)



  public:
    OmronWidget(QString ParentName, QString MyName, QWidget *parent );
    ~OmronWidget();
    TActivity Activity;
    Fins *WhereFins;

    int value() const { return _value; }

    void setValue( QString Value );
    void SetWhereFins(Fins *addr);


    void setActivity(TActivity Act);
    void setBackground(int r, int g, int b);

  public slots:
    void setValueI( int Value );
    void RefreshFromFins ();

signals:
    void nextFieldSig();
    void prevFieldSig();

  protected:

  private:
    Ui::OmronWidget *ui;

    QSettings *InitSettings;
    QSignalMapper *signalMapper;
    QSignalMapper *signalMapper2;


    int _value;
    int key;

    QString WhoAmI;
    QString MyNameIs;
    QString MemType;
    int MemSize;
    int MemAddr;

  private slots:
    bool eventFilter(QObject *obj, QEvent *e);
};

#endif // OMRONWIDGET_H
